import { INITTOPIC, GETTOPICDATA } from "../types/TopicType";
const initialState = {
  message: {
    // 页面数据
    data: {},
  },
};

const TopicReducer = (state = initialState, { type, payload }) => {
  let newState = JSON.parse(JSON.stringify(state));
  switch (type) {
    case INITTOPIC:
      newState.message.data = {};
      break;
    case GETTOPICDATA:
      newState.message.data = payload.data;
      break;
    default:
      return state;
  }
  return newState;
};

export default TopicReducer;
